package com.yylending.las.lending.quota.credit;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.content.Loader;
import android.view.View;
import android.widget.Button;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.yyfax.infrastructure.mvp.Presenter;
import com.yyfax.infrastructure.statistics.StatService;
import com.yylending.las.R;
import com.yylending.las.StatIDSet;
import com.yylending.las.base.BaseActivity;

/**
 * 征信授权失败
 * Created by laixj on 2017/6/22.
 * Copyright ©2016 www.yylending.com. All Rights Reserved.
 */
public class AuthFailureActivity extends BaseActivity {

	private final static String TAG = "AuthFailureActivity";

	@BindView(R.id.authority_failure_btn)
	Button mAuthorityFailureBtn;

	public static void startForResult(Fragment aty, int requestCode) {
		Intent i = new Intent(aty.getActivity(), AuthFailureActivity.class);
		aty.startActivityForResult(i, requestCode);
	}

	@Override
	public Loader<Presenter> onCreateLoader(int id, Bundle args) {
		return null;
	}

	@Override
	public void onLoadFinished(Loader<Presenter> loader, Presenter data, int placeholder) {

	}

	@Override
	protected void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.fragment_credit_auth_failure);
		ButterKnife.bind(this);
		setTitle(R.string.credit_authority);
	}

	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
	}

	@Override
	protected void onRestoreInstanceState(Bundle savedInstanceState) {
		super.onRestoreInstanceState(savedInstanceState);
	}

	@Override
	protected void onStart() {
		super.onStart();
	}

	@Override
	protected void onStop() {
		super.onStop();
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
	}

	@Override
	public void onResume() {
		super.onResume();
	}

	@OnClick(R.id.authority_failure_btn)
	public void onViewClicked(View view) {
		switch (view.getId()) {
			case R.id.authority_failure_btn:
				StatService.onEvent(this, StatIDSet.EVENT_ID_CREDIT_AUTHORIZATION_FAILED);
				setResult(RESULT_OK);
				finish();
				break;
		}
	}

	@Override
	protected void onBackBtnPressed() {
		setResult(RESULT_OK);
		finish();
	}

	@Override
	public void onBackPressed() {
		setResult(RESULT_OK);
		finish();
	}
}
